<html><body><pre>
<script>
Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
}
Array.method('filter', function(f) {
    var res = [];
    for (var i=0; i<this.length; i++) {
        if (f(this[i])) {
            res.push(this[i]);
        }
    }    
    return res;
});
var v = [2, 3, 5, 8];
document.writeln(
    v.filter(
        function (x) {return x%2}
    )
);

</script>
</pre></body></html>
